package org.sy.lab.多线程基础._3_同步辅助类._1_Semaphore信号量;

//Semaphore有限流的效果
//10个文件，3台打印机，同时最多有3个文件处于正在打印的状态
public class Main {

	public static void main(String[] args) {
		
		Queue queue = new Queue();
		MyThread myThread = new MyThread(queue);
		
		for (int i = 0; i < 10; i++) {
			Thread thread = new Thread(myThread, "打印机" + i);
			thread.start();
			try {
				Thread.sleep(1);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
